home *** CD-ROM | disk | FTP | other *** search
- /* Search Altavista thru Amirc or CLI. © 2000 by PurpleT. Requires HttpResume */
- /* Bug reports? suggestions? Mailto: purplet@dingoblue.net.au */
-
- /* P R E F S A R E A */
-
-
- MaxHits = 3
-
- ShowLinkTitle = "N" /* [ Y/N ] */
- ShowDescription = "N" /* [ Y/N ] */
- ShowLastModified = "N" /* [ Y/N ] */
- ShowFileSize = "N" /* [ Y/N ] */
-
- SeparateOutput = "N" /* [ Y/N ] */
- DeleteTempAfter = "Y" /* [ Y/N ] */
-
- AVSTempFile = "Ram:AVSTemp.html"
- HttpResumePath = "C:HttpResume"
-
-
- /* E N D P R E F S */
-
-
-
-
- /* Don't Edit Anything Below This Point!! */
-
- Options results
- parse arg SearchString;NL='0a'x;ES= d2c(27);Bold = d2c(2);TC = 1
-
- CheckIt = getclip(AVSearch)
-
- If CheckIt = "RUN" then DO
- techo("Search already in progress. Wait for current search to finish.")
- Exit
- End
-
- Setclip(AVSearch,"RUN")
-
- If SearchString = "" then DO
- Techo("Usage: /RX AVSearch <Search Keywords>")
- Call EndProg
- End
-
- If exists(httpresumepath) = 0 then DO
- Techo("Error: You need HttpResume to use this! :)")
- Call EndProg
- End
-
- Techo("Searching for "bold""SearchString""Bold" on AltaVista, MaxHits = "bold""MaxHits""bold", Please wait...")
-
- SearchString2 = Translate(SearchString,"+"," ")
- If Exists(AVSTempFile) = 1 then Address command "delete >nil: "AVSTempFile
- address command httpresumepath' url = "http://www.altavista.com/cgi-bin/query?pg=q&sc=on&hl=on&act=2006&par=0&q='SearchString2'&search.x=21&search.y=6&kl=XX&stype=stext" OF = 'AVSTempFile' Referer = "http://www.altavista.com" >nil:'
-
- If Exists(AVSTempFile) = 0 then DO
- Techo("Error: File not found - "AVSTempFile)
- Call EndProg
- End
-
- Open(File1,AVSTempFile,"R")
-
- If MaxHits > 10 then MaxHits = 10
-
- Do i = 1 to MaxHits
- HLine = readln(file1)
- Do until HLine = "<b>"i". </b>"
- HLine = ReadLn(File1)
- If Find(HLine,"found no document matching your") ~=0 then DO
- Techo("No matches found for "Bold""SearchString)
- Call EndProg
- End
- If upper(HLine) = "</HTML>" then DO
- Call EndProg
- End
- End
- XT=Readln(File1);XT=Readln(File1)
- ULine = Translate(SubStr(Readln(File1),14),"",""">")
- techo(bold""i". "Bold""ULine)
- XT=Readln(File1);XT=Readln(File1);XT=Readln(File1)
- LinkTitle = ReadLn(File1);LinkTitle = SubStr(LinkTitle,4,Length(LinkTitle)-16)
- Description = ReadLn(File1);Description = SubStr(Description,5)
- XT=ReadLn(File1);XT=ReadLn(File1)
- LastModified = ReadLn(File1)
- FileSize = ReadLn(File1);FileSize = SubStr(Left(FileSize,Length(Filesize)-11),4)
-
- If upper(ShowLinkTitle) = "Y" then Techo(Bold" "bold""LinkTitle)
- If upper(ShowDescription) = "Y" then Techo(Bold" "Bold""Description)
- If upper(ShowLastModified) = "Y" then Techo(Bold" "Bold""LastModified)
- If upper(ShowFileSize) = "Y" then Techo(Bold" "Bold""FileSize)
- If Upper(SeparateOutput) = "Y" then Techo(Bold""Bold)
- End
- Call EndProg
- Exit
-
- EndProg:
- Close(File1)
- Techo(Bold"Search Complete")
- SetClip(AVSearch,"")
- If Upper(DeleteTempAfter) = "Y" then DO
- address command 'C:Delete >nil: 'AVSTempFile
- End
- Exit
- Return
-
- Techo:
- parse arg EchoString
- "ECHO P="d2c(27)"b«AVSearch» C="TC" "EchoString
- say EchoString
- Return 0
-